<template>
	<ve-pie :data="data" :settings="settings" :width="width" :height="height" :extend="extend"></ve-pie>
</template>

<script>
//饼图
export default {
	props: {
		//图表数据
		data: {
			type: Object,
			default: () => {
				return {
					columns: [],
					rows: [],
				};
			},
		},
		//图表扩展属性
		extend: {
			type: Object,
			default: () => {
				return {
					//默认图表的颜色
					//color: ['pink', 'skyblue', 'gold', 'yellow'],
				};
			},
		},
		//图表的宽度
		width: {
			type: String,
			default: '100%',
		},
		//图表的高度
		height: {
			type: String,
			default: '300px',
		},

		//legend显示数量限制
		legendLimit: {
			type: Number,
			default: 0,
		},
		//饼图半径
		radius: {
			type: Number,
			default: 120,
		},
	},
	data() {
		return {
			settings: {
				offsetY: parseInt(this.height) / 2,
				radius: this.radius,
				legendLimit: this.legendLimit,
				label: {
					formatter: '{b}\n{c}\n{d}%',
					color: '#333',
					align: 'left',
					lineHeight: 22,
					fontSize: 14,
				},
				labelLine: {
					length: 20,
					lineStyle: {
						type: 'dashed',
						color: '#ccc',
					},
				},
			},
		};
	},
};
</script>

<style lang="scss" scoped></style>
